# -*- coding: utf-8 -*-
from bigmama.Statistics.models import BuildByAge
from django.http import HttpResponse
# Create your views here.
def insert_stat_build_page(request):
    if request.method != 'POST':
        return HttpResponse("[Error] insert_stat_build_page : It only permits POST messages")

    _report_year = request.POST['report_year']
    _parts = request.POST['parts']
    _age = request.POST['age']        
    _avg = request.POST['avg']
    _dev = request.POST['dev']    
    _top_5 = request.POST['top_5']
    _top_10 = request.POST['top_10']
    _top_25 = request.POST['top_25']
    _top_50 = request.POST['top_50']
    _top_75 = request.POST['top_75']
    _top_90 = request.POST['top_90']
    _top_95 = request.POST['top_95']     
    _gender = request.POST['gender'] 

    data = BuildByAge(report_year=_report_year, parts=_parts, age=_age, avg=_avg, dev=_dev, top_5=_top_5, top_10=_top_10, top_25=_top_25, top_50=_top_50, top_75=_top_75, top_90=_top_90, top_95=_top_95, gender=_gender)
    data.save()

    return HttpResponse("[Success] insert_stat_build_page : succesfully registerd!")